package com.controller.user;

import com.pojo.User;
import com.service.UserService;
import com.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Api(tags = "用户相关接口")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 查询用户信息
     * @param phone
     * @return
     */
    @GetMapping("/query")
    public Result<User> userQuery(String phone){
        User user=userService.userQuery(phone);
        return Result.success(user);
    }

    /**
     * 修改用户信息
     * @return
     */
    @PostMapping("/update")
    public Result<String> update(@RequestBody User user){
        userService.update(user);
        return Result.success("用户信息修改成功");
    }

}
